#include "TextLine.h"
#include "TextBlock.h"

TextLine::TextLine()
{
}

TextLine::~TextLine()
{
}

TextLine* TextLine::NewL()
{
	TextLine* self = TextLine::NewLC();
	CleanupStack::Pop(self);
	
	return self;
}

TextLine* TextLine::NewLC()
{
	TextLine* self = new(ELeave) TextLine;
	CleanupStack::PushL(self);
	self->ConstructL();
	
	return self;
}

void TextLine::ConstructL()
{

}

void TextLine::PushL(CTextBlock* aBlock)
{
	iTextBlockArray.PushL((IItem*)aBlock);
	
	TRect rcBlock = aBlock->GetBlockRect();
	iLineRect.SetWidth(iLineRect.Width() + rcBlock.Width());
	if(rcBlock.Height() > iLineRect.Height())
		iLineRect.SetHeight(rcBlock.Height());
	
}

TRect TextLine::GetLineRect() const
{
	return iLineRect;
}

LinkTemplate* TextLine::GetTextBlockArray()
{
	return &iTextBlockArray;
}